import React, { Component } from 'react'
import './App.css'
import List from './components/List'
import Search from './components/Search'

class App extends Component {
  // 初始化状态
  state = {
    users: [], // 初始化数据
    isFirst: true, // 第一次加载
    isLoading: false, // 标识是否处于加载中
    err: '' // 请求错误信息
  }

  // 更新App的State
  updateAppState = (stateObj) => {
    this.setState(stateObj)
  }

  render() {
    return (
      <div className="container">
        <Search updateAppState={this.updateAppState} />
        <List {...this.state} />
      </div>
    )
  }
}

export default App
